import pygame

from Action.SpriteWelcome import WelcomeSprite
from Scene.BaseScene import BaseScene, ScenePassStatus


class WelcomeScene(BaseScene):
    """
    欢迎场景
    """
    def __init__(self, wel_sprite):
        super(WelcomeScene, self).__init__(wel_sprite,
                                           "../Resources/images/welcome/welcome.jpg")
        self.actor = WelcomeSprite(50, 300, "../Resources/images/welcome/%d-1.png", 9)
        pygame.mixer.music.load("../Resources/sound/地道战.mp3")
        pygame.mixer.music.play(start=20)
    def draw_actor(self):
        self.actor.draw(self.current_surface)

    def run(self, down_flag, key_list):
        self.actor.run(down_flag, key_list)
        if self.actor.pos_x > 1000:
            self.pass_status = ScenePassStatus.over
            pygame.mixer.music.stop()

    def get_pass_status(self):
        if self.pass_status != ScenePassStatus.over:
            return self.pass_status, None
        else:
            return self.pass_status, "TunnelWarScene"
